<template>
  <div class="banner">
    <van-swipe class="my-swipe"  :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="item in bnrList" :key="item.id" @click="goDetails(item.id,item.classid)">
        <img :src="item.picurl" alt="">
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import { bnrAxios } from '@/network/indexAxios'
export default {
  data () {
    return {
      bnrList: []
    }
  },
  async mounted () {
    await this.getbandata()
  },
  methods: {
    goDetails (id, cid) {
      this.$router.push('/detail?id=' + id + '&type=list&cid=' + cid)
      // this.$router.push("/detail?id="+id +"&type=list&cis="+cid);
    },
    // 获取banner数据
    // async getbandata(){
    //  await this.$ajax({
    //   url:"/getList.php",
    //   params:{
    //     tejian:true
    //   }
    // }).then(res=>{
    //   console.log(res)
    //   this.bnrList=res.data.data
    // })
    // }
    async  getbandata () {
      await bnrAxios().then(res => {
        console.log(res)
        this.bnrList = res.data
      })
    }
  }
}
</script>

<style lang="less" scoped>
.banner{
  background-color:#ccc;
  height: 5rem;
  img{
    width: 100%;
    height:5rem;
  }
}
</style>
